package org.lw.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"org.lw.controller","org.lw.advice"})
public class WebConfig  implements WebMvcConfigurer {

  /*  @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {

        configurer.enable();
    }
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")   // 允许跨域访问的路径
                .allowedOrigins("http://localhost:8081")  // 允许跨域访问的源
                .allowedMethods("GET", "POST", "PUT", "DELETE")  // 允许请求方法
                .allowCredentials(false).maxAge(3600); // 允许Session跨域
    }*/
}
